home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programmer Power Tools
/
Programmer Power Tools.iso
/
pcresrc
/
pcr8808.arc
/
CTRLKEY.BAS
next >
Wrap
BASIC Source File
|
1988-05-04
|
1KB
|
32 lines
0 CLS:KEY OFF ' turn off 25th line key list
10 FOR J=1 TO 10
20 KEY J,"" ' disable function key assignments
30 NEXT J
40 PRINT"Press any key to begin"
50 X$=INKEY$ ' get keystroke from keyboard
60 IF X$="" THEN 50 ' loop if no keys pressed
70 A=ASC(RIGHT$(X$,1)) ' isolate the second character
80 IF LEN(X$)=2 THEN 130 ' branch if extended key code
90 PRINT X$, ' print the text character
100 PRINT"ASCII: "; ASC(X$) ' and its ASCII value
110 GOTO 50 ' loop for another keystroke
120 ' cursor, control and function keys are evaluated here
130 IF A=72 THEN KY$="UP ARROW"
140 IF A=80 THEN KY$="DOWN ARROW"
150 IF A=75 THEN KY$="LEFT ARROW"
160 IF A=77 THEN KY$="RIGHT ARROW"
170 IF A=73 THEN KY$="PAGE UP"
180 IF A=81 THEN KY$="PAGE DOWN"
190 IF A=71 THEN KY$="HOME"
200 IF A=79 THEN KY$="END"
210 IF A=82 THEN KY$="INSERT"
220 IF A=83 THEN KY$="DELETE"
230 IF A>58 AND A<69 THEN KY$="F"+STR$(A-58)
240 IF A>83 AND A<94 THEN KY$="SHIFT-F"+STR$(A-83)
250 IF A>93 AND A<104 THEN KY$="CTRL-F"+STR$(A-93)
260 IF A>103 AND A<114 THEN KY$="ALT-F"+STR$(A-103)
270 PRINT KY$, ' extended code key assignment
280 PRINT"ASCII:";ASC(LEFT$(X$,1));ASC(RIGHT$(X$,1))
290 KY$=""
300 GOTO 50 ' loop for another keystroke